import java.util.ArrayList;
import java.util.List;

public class Leetcode83 {
    public static void main(String[] args) {
        ListNode node = new ListNode();
        List<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(3);
        ListNode.createNode(node, list);
        deleteDuplicates(node);
        System.out.println(node);
    }

    public static ListNode deleteDuplicates(ListNode head) {
        if (head == null || head.next == null) {
            return head;
        }

        head.next = deleteDuplicates(head.next);
        if (head.val == head.next.val) {
            head = head.next;
        }
        return head;
    }
}
